import java.util.Stack;

public class Solution {
    Stack<Integer> s = new Stack<>();
    Stack<Integer> min = new Stack<>();
    int m=Integer.MAX_VALUE;

    public void push(int node) {
        s.push(node);
        if(node<m){
            min.push(node);
            m = node;
        }
        else
            min.push(m);
    }

    public void pop() {
        s.pop();
        min.pop();
    }

    public int top() {
        return s.peek();
    }

    public int min() {
        return min.peek();
    }
    public static void main(String args[]){
        Solution s1 = new Solution();
        for(int i=0; i<5; i++){
            s1.push(1);
        }
        System.out.println(s1.min());
    }
}